package com.second.app.chouxiang;

public  abstract class Person {
    String name;
    int age;
    String occupation;
    public Person(String name,int age,String occupation ){
        this.name =name;
        this.age =age;
        this.occupation = occupation;
    }
    abstract String talk();
}

class Student extends Person {

    public Student(String name, int age, String occupation) {
        //todo 子类必须明确调用抽象类中的构造方法
       super(name,age,occupation);
    }

    @Override
    String talk() {
        return "学生---姓名：" + this.name + ",年龄：" + this.age + ",职业：" + this.occupation;
    }
}

class Worker extends Person {

    public Worker(String name, int age, String occupation) {
        super(name,age,occupation);
    }

    @Override
    String talk() {
        return "工人--姓名：" + this.name + ",年龄：" + this.age + ",职业：" + this.occupation;
    }
}
class AbstractConstructor{
    public static void main(String []args){
        Student s = new Student("张三",18,"学生");
        System.out.println(s.talk());

    }
}